/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/*
 * ScrollCanvasTest.java
 *
 * Created on Jun 3, 2009, 9:04:46 AM
 */

package GeneralTesting;

import java.awt.Dimension;

/**
 *
 * @author Heather
 */
public class ScrollCanvasTest extends javax.swing.JApplet {

    /** Initializes the applet ScrollCanvasTest */
    public void init() {
        try {
            java.awt.EventQueue.invokeAndWait(new Runnable() {
                public void run() {
                    initComponents();
                }
            });
        } catch (Exception ex) {
            ex.printStackTrace();
        }
    }

    /** This method is called from within the init() method to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
  // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
  private void initComponents() {

    growButton = new javax.swing.JButton();
    jButton2 = new javax.swing.JButton();
    jScrollPane1 = new javax.swing.JScrollPane();
    growPanel = new javax.swing.JPanel();
    jScrollPane2 = new javax.swing.JScrollPane();
    anotherPanel = new javax.swing.JPanel();

    getContentPane().setLayout(null);

    growButton.setText("Grow");
    growButton.addActionListener(new java.awt.event.ActionListener() {
      public void actionPerformed(java.awt.event.ActionEvent evt) {
        growButtonActionPerformed(evt);
      }
    });
    getContentPane().add(growButton);
    growButton.setBounds(310, 10, 230, 170);

    jButton2.setText("jButton2");
    getContentPane().add(jButton2);
    jButton2.setBounds(310, 190, 230, 170);

    growPanel.setBackground(new java.awt.Color(204, 204, 255));
    growPanel.setMinimumSize(new java.awt.Dimension(230, 210));
    growPanel.setPreferredSize(new java.awt.Dimension(230, 210));

    javax.swing.GroupLayout growPanelLayout = new javax.swing.GroupLayout(growPanel);
    growPanel.setLayout(growPanelLayout);
    growPanelLayout.setHorizontalGroup(
      growPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
      .addGap(0, 251, Short.MAX_VALUE)
    );
    growPanelLayout.setVerticalGroup(
      growPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
      .addGap(0, 210, Short.MAX_VALUE)
    );

    jScrollPane1.setViewportView(growPanel);

    getContentPane().add(jScrollPane1);
    jScrollPane1.setBounds(10, 10, 270, 200);

    anotherPanel.setBackground(new java.awt.Color(204, 255, 255));

    javax.swing.GroupLayout anotherPanelLayout = new javax.swing.GroupLayout(anotherPanel);
    anotherPanel.setLayout(anotherPanelLayout);
    anotherPanelLayout.setHorizontalGroup(
      anotherPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
      .addGap(0, 268, Short.MAX_VALUE)
    );
    anotherPanelLayout.setVerticalGroup(
      anotherPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
      .addGap(0, 148, Short.MAX_VALUE)
    );

    jScrollPane2.setViewportView(anotherPanel);

    getContentPane().add(jScrollPane2);
    jScrollPane2.setBounds(10, 220, 270, 150);
  }// </editor-fold>//GEN-END:initComponents

    private void growButtonActionPerformed(java.awt.event.ActionEvent evt)//GEN-FIRST:event_growButtonActionPerformed
    {//GEN-HEADEREND:event_growButtonActionPerformed
      // TODO add your handling code here:
      Dimension d = growPanel.getSize();
      Dimension newD = new Dimension(d.width*2, d.height);

      growPanel.setPreferredSize(newD);
      growPanel.setSize(newD);
      System.out.println(newD.toString());

      anotherPanel.setPreferredSize(newD);
      anotherPanel.setSize(newD);
    }//GEN-LAST:event_growButtonActionPerformed


  // Variables declaration - do not modify//GEN-BEGIN:variables
  private javax.swing.JPanel anotherPanel;
  private javax.swing.JButton growButton;
  private javax.swing.JPanel growPanel;
  private javax.swing.JButton jButton2;
  private javax.swing.JScrollPane jScrollPane1;
  private javax.swing.JScrollPane jScrollPane2;
  // End of variables declaration//GEN-END:variables

}
